package zhoug.common.prodivers;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;


import zhoug.common.utils.AppUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * 在manifest文件中注册后 初始化AppContext
 *
 * @Author 35574
 * @Date 2020/4/9
 * @Description
 */
@Deprecated
public class AppContextProvider extends ContentProvider {

    private static Context appContext;

    public static Context getAppContext() {
        if(appContext==null){
            appContext= AppUtils.getApplicationByReflect();
        }
        return appContext;
    }

    @Override
    public boolean onCreate() {
        if (getContext() != null) {
            appContext = getContext().getApplicationContext();
        }
        return true;
    }

    @Nullable
    @Override
    public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
        return null;
    }

    @Nullable
    @Override
    public String getType(@NonNull Uri uri) {
        return null;
    }

    @Nullable
    @Override
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
        return null;
    }

    @Override
    public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }

    @Override
    public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }

}
